if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
    window.location.href = "https://www.baidu.com/";
} else {
    //如果是PC用户;
}//判断PC端用户还是移动端用户
var app = angular.module('app', []);
app.controller('IndexController',function($scope,$timeout){
  $scope.dsa = function(){
    alert('dsa');
  };
  $scope.subber="subbar.html";
  $scope.header="headerleft.html";
  $scope.clickUrl=function(name){
     if(name=="writetext"){
      if ($scope.indexUrl==="writetext.html") {

      }else{
         $scope.indexUrl="writetext.html";

        $timeout(function(){
          var div = document.createElement("div");
          div.id = "editor";
          var p = document.createElement("p");
          p.innerHTML = "写点啥。。。";
          div.appendChild(p);
          var child = document.getElementById("childtext");
          child.appendChild(div);
          var E = window.wangEditor
          var editor = new E('#editor');
          // 或者 var editor = new E( document.getElementById('#editor') )
          editor.create();
        },1);
        }
      }else if(name=="test"){
        $scope.indexUrl="test.html";
        $timeout(function(){
          $('#resetbtn').click();
          layui.use('form', function(){
          var form = layui.form;
          //各种基于事件的操作，下面会有进一步介绍
        });
      },1);
      }
  };
$scope.clickUrl('writetext');
  $scope.refreshScroll=function(){
     $timeout(function(){
     $scope.$apply();
   },100);
  };
});

layui.use('element', function(){
  var element = layui.element;
});